#include "StatusWindow.h"
#include <QVBoxLayout>
#include <QHBoxLayout>
#include <QLabel>
#include <QTextEdit>
#include <QLineEdit>
#include <QPushButton>
#include "Product.h"
#include <QHeaderView>
#include <QString>
#include <QtSvg>


StatusWindow::StatusWindow(QWidget *parent) :
        QWidget(parent)

{
    count= new CountActivity(this,&bd);
 //   login= new LoginWidget(this);
    QTime time;
    totalTimer = new QTimer(this);
    totalTimer->start(1000);
    connect(totalTimer,SIGNAL(timeout()),this, SLOT(setColorTrackEat()));
    connect(&count->stopButton, SIGNAL(clicked()), SLOT(updateStatus()));

    connect(count->countTimer2, SIGNAL(timeout()), SLOT(updateStatus()));

    svgB = new QSvgWidget(this);
    svgE = new QSvgWidget(this);
    svgA = new QSvgWidget(this);
    fileNorm = ":/1.svg";
    fileMiddle= ":/2.svg";
    fileBad= ":/3.svg";
    BMI=new QLabel(this);
    BMI->setText("BMI");
    Eat=new QLabel(this);
    Eat->setText("Eat");
    Activity=new QLabel(this);
    Activity->setText("Activity");


    setEating();
    setFitnessCosts();

  /*  statusLbl=new QLabel(tr("<CENTER><H3>Current status on Today</H3></CENTER>"),this);
    controlEat=new QLabel(tr("<H4>Eating control</H4>"),this);
    controlActivity=new QLabel(tr("<H4>Activity control</H4>"),this);
    general=new QLabel(tr("<H4>General</H4>"),this);*/
    statusDay=new QLabel(this);

   /* statusBMI=new QLabel(this);
    statusBMI->setAlignment(Qt::AlignCenter);*/
    /*statusEat=new QLabel(this);
    statusEat->setAlignment(Qt::AlignCenter);*/
    trackEat=new QLabel(this);
   /* statusActivity=new QLabel(this);
    statusActivity->setAlignment(Qt::AlignCenter);*/
    trackActivity = new QLabel(this);

    if (bd.statusBMI()==0)
    {
        statusDay->setStyleSheet("background-color: green");
        //statusBMI->setText("Normal");
        svgB->load(fileNorm);
    }
    else
        if (bd.statusBMI()==-1)
        {
            statusDay->setStyleSheet("background-color: yellow");
            //statusBMI->setText("Underweight");
            svgB->load(fileMiddle);
        }
    else
        if (bd.statusBMI()==-2)
        {
            statusDay->setStyleSheet("background-color: red");
            //statusBMI->setText("Severely underweight");
            svgB->load(fileBad);
        }
    else
        if (bd.statusBMI()==1)
        {
            statusDay->setStyleSheet("background-color: yellow");
            //statusBMI->setText("Overweight");
            svgB->load(fileMiddle);
        }
    else
        if (bd.statusBMI()==2)
        {
            statusDay->setStyleSheet("background-color: red");
            //statusBMI->setText("Obese Class I");
            svgB->load(fileBad);
        }
    else
        if (bd.statusBMI()==3)
        {
            statusDay->setStyleSheet("background-color: red");
            //statusBMI->setText("Obese Class II");
            svgB->load(fileBad);
        }
    else
        if (bd.statusBMI()==4)
        {
            statusDay->setStyleSheet("background-color: red");
            //statusBMI->setText("Obese Class III");
            svgB->load(fileBad);
        }
    statusDay->setFixedHeight(BMI->height()/5);
    double bmi= (BMI->height())*0.5;
    svgB->setFixedSize(bmi,bmi);




    setColorTrackEat();
    trackEat->setFixedHeight(Eat->height()/5);
    svgE->setFixedSize((Eat->height())*0.5, (Eat->height())*0.5);


    setColorTrackActivity();
    trackActivity->setFixedHeight(Activity->height()/5);
    svgA->setFixedSize((Activity->height())*0.5, ((Activity->height())*0.5));


    QHBoxLayout *ll1 = new QHBoxLayout;
    //BMI->showMinimized();
    ll1->addWidget(BMI);
    ll1->addWidget(statusDay,this->width()-BMI->width()-svgB->width()-50);

   /* QVBoxLayout *ll1v = new QVBoxLayout;
    ll1v->addLayout(ll1h);
    ll1v->addWidget(statusBMI);

    QHBoxLayout *ll1 = new QHBoxLayout;
    ll1->addLayout(ll1v);*/
    ll1->addWidget(svgB);



    QHBoxLayout *ll2 = new QHBoxLayout;
   // Eat->showMinimized();
    ll2->addWidget(Eat);
    ll2->addWidget(trackEat,this->width()-BMI->width()-svgB->width()-50);

 /*   QVBoxLayout *ll2v = new QVBoxLayout;
    ll2v->addLayout(ll2h);
    ll2v->addWidget(statusEat);

    QHBoxLayout *ll2 = new QHBoxLayout;
    ll2->addLayout(ll2v);*/
    ll2->addWidget(svgE);

    QHBoxLayout *ll3 = new QHBoxLayout;
    // Activity->showMinimized();
    ll3->addWidget(Activity);
    ll3->addWidget(trackActivity,this->width()-BMI->width()-svgB->width()-50);

    /*QVBoxLayout *ll3v = new QVBoxLayout;
    ll3v->addLayout(ll3h);
    ll3v->addWidget(statusActivity);

    QHBoxLayout *ll3 = new QHBoxLayout;
    ll3->addLayout(ll3v);*/
    ll3->addWidget(svgA);

   /* QHBoxLayout *ll4 = new QHBoxLayout;
    ll4->addWidget(ball);
    ll4->addWidget(metabolism);*/

    tbl=new QTableWidget(this);
    tbl->setColumnCount(3);
    tbl->setRowCount(4);
    QStringList lst1;
    QStringList lst2;
    lst1<<"Cons"<<"Rec"<<"Goal";
    lst2<<"P"<<"F"<<"C"<<"E";

    tbl->setHorizontalHeaderLabels(lst1);
    tbl->setVerticalHeaderLabels(lst2);

    tbl->horizontalHeader()->setResizeMode(QHeaderView::Stretch);
    tbl->verticalHeader()->setResizeMode(QHeaderView::Stretch);

    QTableWidgetItem *cp=new QTableWidgetItem;
    cp->setText(QString::number(bd.getconsumedProtein()));
    tbl->setItem(0,0,cp);
    cp->setFlags(Qt::ItemIsEditable);
    cp->setTextColor(Qt::black);
    QTableWidgetItem *cf=new QTableWidgetItem;
    cf->setText(QString::number(bd.getconsumedFat()));
    tbl->setItem(1,0,cf);
    cf->setFlags(Qt::ItemIsEditable);
    cf->setTextColor(Qt::black);

    QTableWidgetItem *cc=new QTableWidgetItem;
    cc->setText(QString::number(bd.getconsumedCarbohydrate()));
    tbl->setItem(2,0,cc);
    cc->setFlags(Qt::ItemIsEditable);
    cc->setTextColor(Qt::black);

    QTableWidgetItem *ce=new QTableWidgetItem;
    ce->setText(QString::number(bd.getconsumedEnergy()));
    tbl->setItem(3,0,ce);
    ce->setFlags(Qt::ItemIsEditable);
    ce->setTextColor(Qt::black);


    QTableWidgetItem *rp=new QTableWidgetItem;
    rp->setText(QString::number(bd.getNeedProteinR()));
    tbl->setItem(0,1,rp);
    rp->setFlags(Qt::ItemIsEditable);
    rp->setTextColor(Qt::black);
    QTableWidgetItem *rf=new QTableWidgetItem;
    rf->setText(QString::number(bd.getNeedFatR()));
    tbl->setItem(1,1,rf);
    rf->setFlags(Qt::ItemIsEditable);
    rf->setTextColor(Qt::black);
    QTableWidgetItem *rc=new QTableWidgetItem;
    rc->setText(QString::number(bd.getNeedCarbohydrateR()));
    tbl->setItem(2,1,rc);
    rc->setFlags(Qt::ItemIsEditable);
    rc->setTextColor(Qt::black);
    QTableWidgetItem *re=new QTableWidgetItem;
    re->setText(QString::number(bd.getNeedEnergyR()));
    tbl->setItem(3,1,re);
    re->setFlags(Qt::ItemIsEditable);
    re->setTextColor(Qt::black);


    QTableWidgetItem *gp=new QTableWidgetItem;
    gp->setText(QString::number(bd.getNeedProteinG()));
    tbl->setItem(0,2,gp);
    gp->setFlags(Qt::ItemIsEditable);
    gp->setTextColor(Qt::black);
    QTableWidgetItem *gf=new QTableWidgetItem;
    gf->setText(QString::number(bd.getNeedFatG()));
    tbl->setItem(1,2,gf);
    gf->setFlags(Qt::ItemIsEditable);
    gf->setTextColor(Qt::black);
    QTableWidgetItem *gc=new QTableWidgetItem;
    gc->setText(QString::number(bd.getNeedCarbohydrateG()));
    tbl->setItem(2,2,gc);
    gc->setFlags(Qt::ItemIsEditable);
    gc->setTextColor(Qt::black);
    QTableWidgetItem *ge=new QTableWidgetItem;
    ge->setText(QString::number(bd.getNeedEnergyG()));
    tbl->setItem(3,2,ge);
    ge->setFlags(Qt::ItemIsEditable);
    ge->setTextColor(Qt::black);

   tbl2=new QTableWidget(this);

    tbl2->setColumnCount(2);
    tbl2->setRowCount(1);
    QStringList l1;
    QStringList l2;
    l1<<"Energy cons"<<"Fitness Plan";
    l2<<"E";

    tbl2->setHorizontalHeaderLabels(l1);
    tbl2->setVerticalHeaderLabels(l2);

    tbl2->horizontalHeader()->setResizeMode(QHeaderView::Stretch);
    tbl2->verticalHeader()->setResizeMode(QHeaderView::Stretch);

    QTableWidgetItem *ec=new QTableWidgetItem;
    ec->setText(QString::number(bd.getFitnessCosts()));
    tbl2->setItem(0,0,ec);
    ec->setFlags(Qt::ItemIsEditable);
    ec->setTextColor(Qt::black);

    QTableWidgetItem *fp=new QTableWidgetItem;
    fp->setText(QString::number(bd.getFitnessPlan()));
    tbl2->setItem(0,1,fp);
    fp->setFlags(Qt::ItemIsEditable);
    fp->setTextColor(Qt::black);

/*tbl->showMinimized();
tbl2->showMinimized();
tbl2->setFixedHeight(tbl->height()/4);*/
  //  centralWidget=new QWidget(this);
  // this->setCentralWidget(centralWidget);



   // QHBoxLayout *CLLayout = new QHBoxLayout;
  //  CLLayout->addWidget(count);
   // CLLayout->addWidget(login);

    QVBoxLayout *mainLayout = new QVBoxLayout/*(centralWidget)*/;
    /*centralWidget->setLayout(mainLayout);*/
   // mainLayout->addWidget(statusLbl);
   // mainLayout->addWidget(login);


    mainLayout->addLayout(ll1);

    mainLayout->addLayout(ll2);
    mainLayout->addLayout(ll3);
    //mainLayout->addLayout(ll4);
    mainLayout->addWidget(count);
  //  mainLayout->addLayout(CLLayout);

   //mainLayout->addWidget(controlEat);
    mainLayout->addWidget(tbl);
  // mainLayout->addWidget(controlActivity);
   mainLayout->addWidget(tbl2);
  // mainLayout->addWidget(svg);


   // mainLayout->setSpacing(15);
   setLayout(mainLayout);
   //QObject::connect(svg.renderer(),SIGNAL(repaintNeeded()), &svg, SLOT(repaint()));

}

/*Bridget StatusWindow::getBd()
{
    return &bd;
}*/


void StatusWindow::updateStatus()
{
    setEating();
    setFitnessCosts();

    bd.setNeedEnergy();
    bd.setNeedFat();
    bd.setNeedProtein();
    bd.setNeedCarbohydrate();


    if ((count->getEnergy()!=0)&&(count->countTimer2->isActive()))
    {
        double spendEnergy=bd.getFitnessCosts()+count->getEnergy();
        bd.setFitnessCosts(spendEnergy);
    }
   // metabolism->setText(QString::number(bd.getMetabolism()));
    if (bd.statusBMI()==0)
    {
        statusDay->setStyleSheet("background-color: green");
        //statusBMI->setText("Normal");
        svgB->load(fileNorm);
    }
    else
        if (bd.statusBMI()==-1)
        {
            statusDay->setStyleSheet("background-color: yellow");
            //statusBMI->setText("Underweight");
            svgB->load(fileMiddle);
        }
    else
        if (bd.statusBMI()==-2)
        {
            statusDay->setStyleSheet("background-color: red");
            //statusBMI->setText("Severely underweight");
            svgB->load(fileBad);
        }
    else
        if (bd.statusBMI()==1)
        {
            statusDay->setStyleSheet("background-color: yellow");
            //statusBMI->setText("Overweight");
            svgB->load(fileMiddle);
        }
    else
        if (bd.statusBMI()==2)
        {
            statusDay->setStyleSheet("background-color: red");
            //statusBMI->setText("Obese Class I");
            svgB->load(fileBad);
        }
    else
        if (bd.statusBMI()==3)
        {
            statusDay->setStyleSheet("background-color: red");
            //statusBMI->setText("Obese Class II");
            svgB->load(fileBad);
        }
    else
        if (bd.statusBMI()==4)
        {
            statusDay->setStyleSheet("background-color: red");
            //statusBMI->setText("Obese Class III");
            svgB->load(fileBad);
        }



   setColorTrackEat();
   setColorTrackActivity();




    tbl->horizontalHeader()->setResizeMode(QHeaderView::Stretch);
  //  tbl.horizontalHeader()->setResizeMode(0, QHeaderView::Stretch);
    tbl->verticalHeader()->setResizeMode(QHeaderView::Stretch);
    QTableWidgetItem *cp=new QTableWidgetItem;
    cp->setText(QString::number(bd.getconsumedProtein()));
    tbl->setItem(0,0,cp);
    cp->setFlags(Qt::ItemIsEditable);
    cp->setTextColor(Qt::black);
    QTableWidgetItem *cf=new QTableWidgetItem;
    cf->setText(QString::number(bd.getconsumedFat()));
    tbl->setItem(1,0,cf);
    cf->setFlags(Qt::ItemIsEditable);
    cf->setTextColor(Qt::black);

    QTableWidgetItem *cc=new QTableWidgetItem;
    cc->setText(QString::number(bd.getconsumedCarbohydrate()));
    tbl->setItem(2,0,cc);
    cc->setFlags(Qt::ItemIsEditable);
    cc->setTextColor(Qt::black);

    QTableWidgetItem *ce=new QTableWidgetItem;
    ce->setText(QString::number(bd.getconsumedEnergy()));
    tbl->setItem(3,0,ce);
    ce->setFlags(Qt::ItemIsEditable);
    ce->setTextColor(Qt::black);


    QTableWidgetItem *rp=new QTableWidgetItem;
    rp->setText(QString::number(bd.getNeedProteinR()));
    tbl->setItem(0,1,rp);
    rp->setFlags(Qt::ItemIsEditable);
    rp->setTextColor(Qt::black);
    QTableWidgetItem *rf=new QTableWidgetItem;
    rf->setText(QString::number(bd.getNeedFatR()));
    tbl->setItem(1,1,rf);
    rf->setFlags(Qt::ItemIsEditable);
    rf->setTextColor(Qt::black);
    QTableWidgetItem *rc=new QTableWidgetItem;
    rc->setText(QString::number(bd.getNeedCarbohydrateR()));
    tbl->setItem(2,1,rc);
    rc->setFlags(Qt::ItemIsEditable);
    rc->setTextColor(Qt::black);
    QTableWidgetItem *re=new QTableWidgetItem;
    re->setText(QString::number(bd.getNeedEnergyR()));
    tbl->setItem(3,1,re);
    re->setFlags(Qt::ItemIsEditable);
    re->setTextColor(Qt::black);


    QTableWidgetItem *gp=new QTableWidgetItem;
    gp->setText(QString::number(bd.getNeedProteinG()));
    tbl->setItem(0,2,gp);
    gp->setFlags(Qt::ItemIsEditable);
    gp->setTextColor(Qt::black);
    QTableWidgetItem *gf=new QTableWidgetItem;
    gf->setText(QString::number(bd.getNeedFatG()));
    tbl->setItem(1,2,gf);
    gf->setFlags(Qt::ItemIsEditable);
    gf->setTextColor(Qt::black);
    QTableWidgetItem *gc=new QTableWidgetItem;
    gc->setText(QString::number(bd.getNeedCarbohydrateG()));
    tbl->setItem(2,2,gc);
    gc->setFlags(Qt::ItemIsEditable);
    gc->setTextColor(Qt::black);
    QTableWidgetItem *ge=new QTableWidgetItem;
    ge->setText(QString::number(bd.getNeedEnergyG()));
    tbl->setItem(3,2,ge);
    ge->setFlags(Qt::ItemIsEditable);
    ge->setTextColor(Qt::black);

    tbl2->setColumnCount(2);
    tbl2->setRowCount(1);
    QStringList l1;
    QStringList l2;
  /*  l1<<"Energy consumption"<<"Fitness Plan";
    l2<<"Energy, kkal";

    tbl2->setHorizontalHeaderLabels(l1);
    tbl2->setVerticalHeaderLabels(l2);*/

    tbl2->horizontalHeader()->setResizeMode(1, QHeaderView::Stretch);
    tbl2->horizontalHeader()->setResizeMode(0, QHeaderView::Stretch);

    tbl2->verticalHeader()->setResizeMode(QHeaderView::Stretch);

    QTableWidgetItem *ec=new QTableWidgetItem;
    ec->setText(QString::number(bd.getFitnessCosts()));
    tbl2->setItem(0,0,ec);
    ec->setFlags(Qt::ItemIsEditable);
    ec->setTextColor(Qt::black);

    QTableWidgetItem *fp=new QTableWidgetItem;
    fp->setText(QString::number(bd.getFitnessPlan()));
    tbl2->setItem(0,1,fp);
    fp->setFlags(Qt::ItemIsEditable);
    fp->setTextColor(Qt::black);

}

Bridget *StatusWindow::getBd()
{
    return &bd;
}


void StatusWindow::setEating()
{

    double Protein=0;
    double Fat=0;
    double Carbohydrate=0;
    double Energy=0;
    QDate date;
    QFile file("Journal.xml");
    if (file.open(QIODevice::ReadOnly))
    {

        if (docJournal.setContent(&file))
        {
            QDomElement root = docJournal.documentElement();
            QDomElement child = root.firstChildElement("food");

            while (!child.isNull())
            {
                if (child.attribute("date", "")==date.currentDate().toString())
                {
                    Protein = Protein+child.firstChildElement("protein").text().toDouble();
                    Fat=Fat+child.firstChildElement("fat").text().toDouble();
                    Carbohydrate = Carbohydrate+child.firstChildElement("carbohydrate").text().toDouble();
                    Energy = Energy+child.firstChildElement("energy").text().toDouble();
                  //  bd.toEat(Fat,Protein,Carbohydrate,Energy);

                }

                child = child.nextSiblingElement("food");


            }
bd.toEat(Fat,Protein,Carbohydrate,Energy);
}
           else
            {

               qDebug()<<"No setContent!";
            }
            file.close();
            }

}

void StatusWindow::setFitnessCosts()
{
    double Fitness=0;

    QDate date;
    QFile file("Journal.xml");
    if (file.open(QIODevice::ReadOnly))
    {

        if (docJournal.setContent(&file))
        {
            QDomElement root = docJournal.documentElement();
            QDomElement child = root.firstChildElement("act");

            while (!child.isNull())
            {
                if (child.attribute("date", "")==date.currentDate().toString())
                {
                    Fitness = Fitness+child.firstChildElement("energy").text().toDouble();

                }

                child = child.nextSiblingElement("act");


            }
bd.setFitnessCosts(Fitness);
}
           else
            {

               qDebug()<<"No setContent!";
            }
            file.close();
            }

}




double StatusWindow::getYesterdayEnergy()
{
    double Energy=0;
    QDate date;
    QDate date1;
    date = date1.currentDate().addDays(-1);
    QFile file("Journal.xml");
    if (file.open(QIODevice::ReadOnly))
    {


        if (docJournal.setContent(&file))
        {
            QDomElement root = docJournal.documentElement();
            QDomElement child = root.firstChildElement("food");

            while (!child.isNull())
            {
                if (child.attribute("date", "")==date.toString())
                {
                        Energy = Energy+child.firstChildElement("energy").text().toDouble();

                }

                child = child.nextSiblingElement("food");
            }
}
           else
            {

               qDebug()<<"No setContent!";
            }
            file.close();
            }
return Energy;
}



double StatusWindow::getEveningEnergy(int lim)
{
    double Energy=0;
    QDate date;
    QDate date1;
    date = date1.currentDate().addDays(-1);
    QFile file("Journal.xml");
    if (file.open(QIODevice::ReadOnly))
    {


        if (docJournal.setContent(&file))
        {
            QDomElement root = docJournal.documentElement();
            QDomElement child = root.firstChildElement("food");

            while (!child.isNull())
            {
                if (child.attribute("date", "")==date.toString())
                {
                    QString t=child.attribute("time","");
                    QTime time1=QTime::fromString(t);
                    if (time1.hour() > lim)
                    {
                        Energy = Energy+child.firstChildElement("energy").text().toDouble();
                    }
                }

                child = child.nextSiblingElement("food");
            }
}
           else
            {

               qDebug()<<"No setContent!";
            }
            file.close();
            }
return Energy;
}


void StatusWindow::setColorTrackEat()
{
    QTime time;
    if ((bd.getconsumedEnergy()==0)&& (time.currentTime().hour()<7)&&
        (getEveningEnergy(17)<250)&& (getYesterdayEnergy()<1000))
    {
        trackEat->setStyleSheet("background-color: red");
        svgE->load(fileBad);
    }
    else
        if ((bd.getconsumedEnergy()==0)&& (time.currentTime().hour()<7)&&
            (getEveningEnergy(17)<250))
        {
        trackEat->setStyleSheet("background-color: yellow");
        svgE->load(fileMiddle);
        }
    else
        if ((time.currentTime().hour()<12)&& (bd.getconsumedEnergy()<250) && (getEveningEnergy(17)<250))
    {
        trackEat->setStyleSheet("background-color: red");
        svgE->load(fileBad);
    }
    else
        if ((time.currentTime().hour()<12)&& (bd.getconsumedEnergy()<250))
    {
        trackEat->setStyleSheet("background-color: yellow");
        svgE->load(fileMiddle);
    }

    else
        if ((time.currentTime().hour()<14)&& (bd.getconsumedEnergy()<750))
    {
        trackEat->setStyleSheet("background-color: yellow");
        svgE->load(fileMiddle);
    }
    else
        if ((time.currentTime().hour()<17)&& (bd.getconsumedEnergy()<750))
    {
        trackEat->setStyleSheet("background-color: red");
        svgE->load(fileBad);
    }
    else
        if ((time.currentTime().hour()<20)&& (bd.getconsumedEnergy()<1000))
    {
        trackEat->setStyleSheet("background-color: yellow");
        svgE->load(fileMiddle);
    }
    else
        if ((time.currentTime().hour()<24)&& (bd.getconsumedEnergy()<1000))
    {
        trackEat->setStyleSheet("background-color: red");
        svgE->load(fileBad);
    }

    else
   if ((bd.getconsumedEnergy()<0.7*bd.getNeedEnergyR())&&(!(bd.getconsumedEnergy()>bd.getFitnessCosts())))
    {
        trackEat->setStyleSheet("background-color: green");
        svgE->load(fileNorm);
    }
    else
        if (/*(bd.getconsumedEnergy()<=bd.getNeedEnergyR())||*/(bd.getconsumedEnergy())>0.8*bd.getFitnessCosts())
        {
            trackEat->setStyleSheet("background-color: yellow");
            svgE->load(fileMiddle);
        }
    else
        {
            trackEat->setStyleSheet("background-color: red");
            svgE->load(fileBad);
        }
    /*if ((time.currentTime().hour()==24) && (time.currentTime().minute()==0))
    {
        //totalTimer->
    }*/
}

void StatusWindow::setColorTrackActivity()
{
    if (bd.getFitnessCosts()>0.8*bd.getFitnessPlan())
    {
        trackActivity->setStyleSheet("background-color: green");
       // statusActivity->setText("Good");
        svgA->load(fileNorm);
    }
    else
        if (bd.getFitnessCosts()>0.4*bd.getFitnessPlan())
        {
            trackActivity->setStyleSheet("background-color: yellow");
          //  statusActivity->setText("Middle");
            svgA->load(fileMiddle);
        }
    else
    {
        trackActivity->setStyleSheet("background-color: red");
     //   statusActivity->setText("Bad");
        svgA->load(fileBad);
    }
}
